package main

import "fmt"

func main() {
	//接口继承
	var a A = Impl{}
	a.test1()
	var b B = Impl{}
	b.test2()
	var c C = Impl{}
	c.test1()
	c.test2()
	c.test3()

	//接口断言（返回值为拷贝）
	result, ok := c.(A)
	fmt.Printf("%T,%v\n", result, ok)  //main.Impl,true
	fmt.Printf("%p,%p\n", &c, &result) //0xc000096210,0xc000096220
}

type A interface {
	test1()
}

type B interface {
	test2()
}

type C interface {
	A
	B
	test3()
}

type Impl struct {
}

func (i Impl) test1() {

}

func (i Impl) test2() {

}

func (i Impl) test3() {

}
